Skip to content

Fix in-place indexing with range/list for 4D arrays#2872

Open
vlad-perevezentsev wants to merge 5 commits intomasterfrom
fix_inplace_indexind_4d
Open

Fix in-place indexing with range/list for 4D arrays#2872
vlad-perevezentsev wants to merge 5 commits intomasterfrom
fix_inplace_indexind_4d

Conversation

@vlad-perevezentsev
Copy link
Copy Markdown
Contributor

This PR proposes to fix #2783 by addressing incorrect in-place updates for 4D arrays.

_is_boolean() in _slicing.pxi had a __bool__ fallback that misclassified range objects as boolean scalar indices since range exposes __bool__. This caused them to insert newaxis(1) instead of being treated as integer index arrays.
The fallback was removed because all legitimate boolean types are already caught by earlier checks in the same function.

range and list are not part of the Python Array API indexing spec but NumPy accepts them as integer index arrays.
Conversion of these types to numpy arrays is added in _get_unwrapped_index_key() in dpnp_array.py which is the NumPy compatibility layer but keeping the tensor layer Array API compliant.

Also added tests for range and list advanced indexing covering to test_indexing.py

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

@github-actions
Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev0=py313h509198e_5 ran successfully.
Passed: 1356
Failed: 4
Skipped: 16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

indexing bug: wrong in-place updates for 4D arrays with paired integer indices

1 participant